home *** CD-ROM | disk | FTP | other *** search
- global gMasterData, gSection, gHistoryList, gQuestionNum, gHistoryAnswerList, gQuestions
-
- on goIntro
- go(label("intro"))
- set gSection to #intro
- goNarrator(gMasterData, "21")
- end
-
- on setUpHistory
- stopSound2()
- go("History1")
- goNarrator(gMasterData, "22")
- set gSection to #history
- set gQuestionNum to 1
- if voidp(gHistoryList) then
- set gHistoryList to [#empty, #empty, #empty, #empty, #empty, #empty, #empty, #empty, #empty, #empty, #empty, #empty, #empty, #empty, #empty, #empty, #empty, #empty, #empty, #empty, #empty, #empty, #empty, #empty, #empty, #empty, #empty, #empty]
- end if
- if voidp(gHistoryAnswerList) then
- set gHistoryAnswerList to [#no, #yes, #yes, #yes, #yes, #yes, #yes, #yes, #yes, #yes, #yes, #no, #yes, #no, #yes, #yes, #yes, #yes, #yes, #yes, #yes, #yes, #yes, #yes, #yes, #yes, #yes, #yes]
- end if
- showTheChoice()
- end
-
- on goBackTo28
- stopSound2()
- go("History1")
- set gSection to #history
- set gQuestionNum to 28
- set the member of sprite 3 to member ("question" && gQuestionNum)
- set the member of sprite 9 to member "done up"
- showTheChoice()
- end
-
- on historyChoice vTheseButtons, vThisChoice, vThisSprite
- repeat with X in vTheseButtons
- if X = vThisSprite then
- nothing()
- next repeat
- end if
- case 1 of
- (X = 5):
- set the memberNum of sprite X to the number of member "yes"
- (X = 6):
- set the memberNum of sprite X to the number of member "no"
- (X = 7):
- set the memberNum of sprite X to the number of member "not"
- end case
- end repeat
- updateStage()
- setAt(gHistoryList, gQuestionNum, vThisChoice)
- end
-
- on nextQuestion
- if gQuestionNum < 28 then
- set gQuestionNum to gQuestionNum + 1
- set the member of sprite 3 to member ("question" && gQuestionNum)
- showTheChoice()
- if gQuestionNum = 28 then
- set the member of sprite 9 to member "done up"
- end if
- updateStage()
- else
- prepareGraph()
- end if
- end
-
- on prevQuestion
- if gQuestionNum > 1 then
- if gQuestionNum = 28 then
- set the member of sprite 9 to member "next up"
- end if
- updateStage()
- set gQuestionNum to gQuestionNum - 1
- set the member of sprite 3 to member ("question" && gQuestionNum)
- showTheChoice()
- end if
- end
-
- on showTheChoice
- set vAnswer to getAt(gHistoryList, gQuestionNum)
- set the memberNum of sprite 5 to the number of member "yes"
- set the memberNum of sprite 6 to the number of member "no"
- set the memberNum of sprite 7 to the number of member "not"
- case vAnswer of
- #yes:
- set the member of sprite 5 to member "yes on"
- #no:
- set the member of sprite 6 to member "no on"
- #not:
- set the member of sprite 7 to member "not on"
- end case
- updateStage()
- end
-
- on prepareGraph
- go("history2")
- setUpQuestions()
- set gSection to #graph
- set vAnswerKey to [#home: [2, 9, 10, 14, 17, 22, 28], #work: [1, 3, 5, 7, 19, 26, 27], #relationship: [4, 6, 16, 18, 20, 21, 23], #self: [8, 11, 12, 13, 15, 24, 25]]
- set vGraphResult to [#home: [0, 0], #work: [0, 0], #relationship: [0, 0], #self: [0, 0]]
- repeat with X = 1 to count(gHistoryList)
- repeat with vProp in [#home, #work, #relationship, #self]
- if getOne(getProp(vAnswerKey, vProp), X) <> 0 then
- set vPick1 to getAt(gHistoryList, X)
- set vCorrectAns1 to getAt(gHistoryAnswerList, X)
- case 1 of
- (vPick1 = vCorrectAns1):
- set vTester to 1
- (vPick1 = #not):
- set vTester to 0
- (vPick1 = #empty):
- set vTester to 0
- otherwise:
- set vTester to 2
- end case
- if vTester > 0 then
- set vThisNum to getAt(getProp(vGraphResult, vProp), vTester)
- set vThisNum to vThisNum + 1
- setAt(getProp(vGraphResult, vProp), vTester, vThisNum)
- end if
- end if
- end repeat
- end repeat
- showGraph(vGraphResult)
- calculatePrint(vGraphResult)
- end
-
- on showGraph vGraphResult
- global gMasterData
- set vThisSprite to 5
- set bottomV to 348
- set topV to 158
- set vNewNotch to (bottomV - topV) / 7
- repeat with vProp in [#home, #work, #relationship, #self]
- repeat with vListPos = 1 to 2
- set vAnswer to getAt(getProp(vGraphResult, vProp), vListPos)
- if vAnswer > 0 then
- set vEndPositionV to bottomV - (vAnswer * vNewNotch)
- AnimateGraph(vThisSprite, vEndPositionV)
- end if
- set vThisSprite to vThisSprite + 1
- end repeat
- end repeat
- goNarrator(gMasterData, "23")
- end
-
- on AnimateGraph vThisSprite, vEndPositionV
- set vStartLocH to the locH of sprite vThisSprite
- set vNewLocV to the locV of sprite vThisSprite
- repeat while vNewLocV >= vEndPositionV
- set vNewLocV to vNewLocV - 2
- set the loc of sprite vThisSprite to point(vStartLocH, vNewLocV)
- updateStage()
- end repeat
- end
-
- on setUpQuestions
- set gQuestions to [#questionNum: 1, #artSprite: 17, #fieldSprite: 18, #numofquestions: 5]
- end
-
- on questionNext
- if the questionNum of gQuestions < the numofquestions of gQuestions then
- set the questionNum of gQuestions to the questionNum of gQuestions + 1
- nextQuest()
- else
- if not activationOn(gMasterData) then
- activate(gMasterData)
- end if
- end if
- end
-
- on questionPrev
- if the questionNum of gQuestions > 1 then
- set the questionNum of gQuestions to the questionNum of gQuestions - 1
- nextQuest()
- end if
- end
-
- on nextQuest
- set the member of sprite the artSprite of gQuestions to member ("quest" && the questionNum of gQuestions)
- set the member of sprite the fieldSprite of gQuestions to member ("decision field" && the questionNum of gQuestions) of castLib "Shared"
- updateStage()
- end
-
- on calculatePrint vGraphResult
- set the floatPrecision to 0
- set vLine to 8
- set vText to EMPTY
- repeat with vProp in [#home, #work, #relationship, #self]
- repeat with vListPos = 1 to 2
- set vAnswer to getAt(getProp(vGraphResult, vProp), vListPos)
- set X to vAnswer / 7.0 * 100.0
- case vListPos of
- 1:
- put "Your" && vProp && "effectiveness percentage is" && X & "." & RETURN after vText
- 2:
- put "Your" && vProp && "ineffectiveness percentage is" && X & "." & RETURN after vText
- end case
- set vLine to vLine + 1
- end repeat
- end repeat
- set the text of field "print2" to vText
- end
-